home *** CD-ROM | disk | FTP | other *** search
Wrap
eeeexxxxpppprrrr((((1111)))) eeeexxxxpppprrrr((((1111)))) NNNNAAAAMMMMEEEE _eeee_xxxx_pppp_rrrr - evaluate arguments as an expression SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS _eeee_xxxx_pppp_rrrr _a_r_g_u_m_e_n_t_s DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN The _a_r_g_u_m_e_n_t_s are taken as an expression. After evaluation, the result is written on the standard output. Terms of the expression must be separated by blanks. Characters special to the shell must be escaped. Note that _0000 is returned to indicate a zero value, rather than the null string. Strings containing blanks or other special characters should be quoted. Integer-valued arguments may be preceded by a unary minus sign. Internally, integers are treated as 32-bit, 2s complement numbers. The length of the expression is limited to 512 bytes. _eeee_xxxx_pppp_rrrr processes supplementary code set characters according to the locale specified in the _LLLL_CCCC______CCCC_TTTT_YYYY_PPPP_EEEE environment variable [see _LLLL_AAAA_NNNN_GGGG on _eeee_nnnn_vvvv_iiii_rrrr_oooo_nnnn(5)]. In regular expressions, pattern searches are performed on characters, not bytes, as described in _rrrr_eeee_gggg_cccc_oooo_mmmm_pppp(5). The operators and keywords are listed below. Characters that need to be escaped in the shell [see _ssss_hhhh(1)] are preceded by _\\\\. The list is in order of increasing precedence, with equal precedence operators grouped within _{{{{_}}}} symbols. _e_x_p_r_1 _\\\\_|||| _e_x_p_r_2 returns the evaluation of _e_x_p_r_1 if it is neither null nor _0000, otherwise returns the evaluation of _e_x_p_r_2. _e_x_p_r_1 _\\\\_&&&& _e_x_p_r_2 returns the evaluation of _e_x_p_r_1 if neither expression evaluates to null or _0000, otherwise returns _0000. Returns the result of a decimal integer comparison if both arguments are integers; otherwise, returns the result of a string comparison using the locale-specific collation sequence. The result of each comparison will be _1111 if the specified relationship is true, or _0000 if the relationship is false. _e_x_p_r_1 { _====, _\\\\_>>>>, _\\\\_>>>>_====, _\\\\_<<<<, _\\\\_<<<<_====, _!!!!_==== } _e_x_p_r_2 returns the result of an integer comparison if both arguments are integers, otherwise returns the result of a lexical comparison. _e_x_p_r_1 { _++++, _---- } _e_x_p_r_2 addition or subtraction of decimal integer-valued arguments. _e_x_p_r_1 { _\\\\_****, _////, _%%%% } _e_x_p_r_2 multiplication, division, or remainder of the decimal integer-valued arguments. PPPPaaaaggggeeee 1111 eeeexxxxpppprrrr((((1111)))) eeeexxxxpppprrrr((((1111)))) _e_x_p_r_1 _:::: _e_x_p_r_2 The matching operator _:::: compares _e_x_p_r_1 with _e_x_p_r_2, which must be a regular expression. Regular expression syntax is defined is defined in the _rrrr_eeee_gggg_cccc_oooo_mmmm_pppp_((((_5555_)))) man page under the section titled: _B_a_s_i_c _R_e_g_u_l_a_r _E_x_p_r_e_s_s_i_o_n, Normally, the matching operator returns the number of bytes matched (_0000 on failure). Alternatively, if the pattern contains at least one regular expression subexpression [\( . . .\)], the string corresponding to \1 will be returned. The use of string arguments _llll_eeee_nnnn_gggg_tttt_hhhh, _ssss_uuuu_bbbb_ssss_tttt_rrrr, _iiii_nnnn_dddd_eeee_xxxx or _mmmm_aaaa_tttt_cccc_hhhh produces unspecified results. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS Add 1 to the shell variable _aaaa: _aaaa_====_````_eeee_xxxx_pppp_rrrr _$$$$_aaaa _++++ _1111_```` The following example emulates _bbbb_aaaa_ssss_eeee_nnnn_aaaa_mmmm_eeee(1)-it returns the last segment of the path name _$$$$_aaaa. For _$$$$_aaaa equal to either _////_uuuu_ssss_rrrr_////_aaaa_bbbb_cccc_////_ffff_iiii_llll_eeee or just _ffff_iiii_llll_eeee, the example returns _ffff_iiii_llll_eeee. (Watch out for _//// alone as an argument: _eeee_xxxx_pppp_rrrr takes it as the division operator; see the NOTES below.) _eeee_xxxx_pppp_rrrr _$$$$_aaaa _:::: _''''_...._****_////_\\\\_((((_...._****_\\\\_))))_'''' _\\\\_|||| _$$$$_aaaa Here is a better version of the previous example. The addition of the _////_//// characters eliminates any ambiguity about the division operator and simplifies the whole expression. _eeee_xxxx_pppp_rrrr _////_////_$$$$_aaaa _:::: _''''_...._****_////_\\\\_((((_...._****_\\\\_))))_'''' Return the number of characters in _$$$$_VVVV_AAAA_RRRR: _eeee_xxxx_pppp_rrrr _$$$$_VVVV_AAAA_RRRR _:::: _''''_...._****_'''' FFFFIIIILLLLEEEESSSS _////_uuuu_ssss_rrrr_////_llll_iiii_bbbb_////_llll_oooo_cccc_aaaa_llll_eeee_////_l_o_c_a_l_e_////_LLLL_CCCC______MMMM_EEEE_SSSS_SSSS_AAAA_GGGG_EEEE_SSSS_////_uuuu_xxxx_cccc_oooo_rrrr_eeee_...._aaaa_bbbb_iiii language-specific message file [See _LLLL_AAAA_NNNN_GGGG on _eeee_nnnn_vvvv_iiii_rrrr_oooo_nnnn (5).] SSSSEEEEEEEE AAAALLLLSSSSOOOO _rrrr_eeee_gggg_cccc_oooo_mmmm_pppp(5), _ssss_hhhh(1) SSSSTTTTDDDDOOOOUUUUTTTT _e_x_p_r will evaluate the expression and write the result to standard output. The character _0000 will be written to indicate a zero value and nothing will be written to indicate a null string. SSSSTTTTDDDDEEEERRRRRRRR Used only for diagnostic messages. PPPPaaaaggggeeee 2222 eeeexxxxpppprrrr((((1111)))) eeeexxxxpppprrrr((((1111)))) DIAGNOSTICS As a side effect of expression evaluation, _eeee_xxxx_pppp_rrrr returns the following exit values: 0 if the expression is neither null nor _0000 1 if the expression is null or _0000 2 for invalid expressions. >2 An error occurred. _ssss_yyyy_nnnn_tttt_aaaa_xxxx _eeee_rrrr_rrrr_oooo_rrrr for operator/operand errors _nnnn_oooo_nnnn_----_nnnn_uuuu_mmmm_eeee_rrrr_iiii_cccc _aaaa_rrrr_gggg_uuuu_mmmm_eeee_nnnn_tttt if arithmetic is attempted on such a string NNNNOOOOTTTTEEEESSSS After argument processing by the shell, _eeee_xxxx_pppp_rrrr cannot tell the difference between an operator and an operand except by the value. If _$$$$_aaaa is an _====, the command: _eeee_xxxx_pppp_rrrr _$$$$_aaaa _==== _''''_====_'''' looks like: _eeee_xxxx_pppp_rrrr _==== _==== _==== as the arguments are passed to _eeee_xxxx_pppp_rrrr (and they are all taken as the _==== operator). The following works: _eeee_xxxx_pppp_rrrr _XXXX_$$$$_aaaa _==== _XXXX_==== PPPPaaaaggggeeee 3333